package com.sec.controller;

import com.sec.dao.mysql.SOtherDao;
import com.sec.util.Pager;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.Map;

/**
 * 测试controller
 * Created by Administrator on 2017/11/29.
 */
@Controller
public class TestController {

    @Resource
    private SOtherDao sOtherDao;

    // 测试分页查询
    @RequestMapping(value="/testPager", method = RequestMethod.GET)
    public void testPager () {
        Pager pager = new Pager();
        pager.setHql("from SOther where o_fl=:o_fl and o_tj=:o_tj");
        pager.setPage(1);
        pager.setRows(3);

        Map<String, Object> params = new HashMap<>();
        params.put("o_fl", 9);
        params.put("o_tj", 0);
        Pager result = sOtherDao.pagerff(pager, params);
        System.out.println(result.getList());

    }

    // 测试前台分页
    @RequestMapping(value="/testFrontPager")
    public String testFrontPager(){
        return "page-pager.html";
    }

    // 测试编辑器
    @RequestMapping(value="/testEditor")
    public String testEditor(){
        return "editor.html";
    }

}
